"""
    输出字符串中的每一个元素
"""
str1 = "abcd"
for item in str1:
    print(item)


"""
    遍历字典时输出的是键
"""
dict1 = {"a1":100,"b2":20,"c3":50}
for key in dict1:
    print(key)

"""
    for...else
"""

for item in str1:
    print(item)
else:
    print("执行完了")


"""
    for...else遇到break跳出将不会执行else
"""
for item in str1:
    if item == "b" :
        break
    print(item)
else:
    print("执行完了")